isNum
Numbers MikeS  Revised

Checking Whether a variable Contains a Valid Number

Problem
=======

How to peek at a variable, to check if it is a number.

Solution
========

_isNum_ returns a positive value if string is numeric

 function isNum(x) {
   return(x == x + 0)
 }

Usage
=====

  if (! isNum(var)) {print "not a number"}

   function IsNum (  x) {
       x=23     ;print "isNum " x "? " isNum(x)
       x="a a " ;print "isNum " x "? " isNum(x)
   }

Discussion
==========

Two related problems are checking if [?isnumString a string contains a valid number] and
[?string2num converting between a string and a number].

Author
======

Michael Sanders

